#ifndef MONTHLYWIDGET_H
#define MONTHLYWIDGET_H

#include <QTableWidget>
#include <QSqlDatabase>
#include <QDate>

class MonthlyWidget : public QTableWidget
{
    Q_OBJECT
public:
    explicit MonthlyWidget(QWidget *parent = 0);

    const QSqlDatabase& db() const{ return db_; }
    void setDatabase(const QSqlDatabase& db){ db_ = db; emit databaseChanged(db); }

    int userID() const{ return userID_; }
    void setUserID(int userid){ userID_ = userid; emit userIDChanged(userID_); }

    const QDate& date() const{ return date_; }
    void setDate(const QDate& date){ date_ = date; emit dateChanged(date_); }

    const QString& dateFormat() const{ return dateFormat_; }
    void setDateFormat(const QString& format){ dateFormat_ = format; emit dateFormatChanged(format); }

    void refresh();

signals:
    void databaseChanged(const QSqlDatabase& db);
    void userIDChanged(int userID);
    void dateChanged(const QDate& date);
    void dateFormatChanged(const QString& format);

public slots:

private slots:
    void on_userID_changed(int userID);
    void on_timeTable_visibled(bool visible);
    void on_date_changed(const QDate& );
    void on_dateFormat_changed(const QString& format);

private:
    QSqlDatabase db_;
    int userID_;
    QDate date_;
    QString dateFormat_;
    qreal heightOfHour_;
};

#endif // MONTHLYWIDGET_H
